﻿using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;

using Wicresoft.Common;
using JDEduTrain.Framework.Entity;
using JDEduTrain.Framework.Business;

public partial class Page_MySelectClassDetail : BaseAuthenticationPage
{
    public Guid ClassID
    {
        get
        {
            if (!string.IsNullOrEmpty(Request["ClassID"]))
                return new Guid(Request["ClassID"]);
            return Guid.Empty;
        }
    }
    public Guid CreditID
    {
        get
        {
            if (!string.IsNullOrEmpty(Request["CreditID"]))
                return new Guid(Request["CreditID"]);
            return Guid.Empty;
        }
    }

    protected void Page_Load(object sender, EventArgs e)
    {
        this.UseTabber = true;
        if (!IsPostBack)
        {
            BindClass();
        }
    }

    protected void BindClass()
    {
        TrainClass trainClass = new TrainClass(ClassID);
        if (trainClass.Load())
        {
            tbBeginTime.Text = trainClass.BeginTime.ToShortDateString();
            tbClassName.Text = trainClass.ClassName;
            tbComment.Text = HttpUtility.HtmlDecode(trainClass.Comment);
            tbEndTime.Text = trainClass.EndTime.ToShortDateString();
            tbCourseInfo.Text = trainClass.CourseInfo;
            tbScore.Text = trainClass.Score.ToString();
            tbPlace.Text = trainClass.Place;
            tbLectorInfo.Text = trainClass.LectorInfo;
            tbTrainLevel.Text = trainClass.TrainLevel;
            tbDeptDisplayName.Text = trainClass.ApplyOrgan;
            tbCurriculum.Text = trainClass.Curriculum;
            tbTrainDay.Text = trainClass.TrainDayCount.ToString();
            tbHostUnit.Text = trainClass.HostUnit;
        }

        TrainCredit credit = new TrainCredit(CreditID);
        if (credit.Load())
        {
            tbBeginTime.Text = credit.BeginTime.ToShortDateString();
            tbClassName.Text = credit.CreditName;
            tbComment.Text = HttpUtility.HtmlDecode(credit.Comment);
            tbEndTime.Text = credit.EndTime.ToShortDateString();
            tbScore.Text = credit.Score.ToString();
            tbTrainLevel.Text = credit.TrainLevel;
            tbTrainDay.Text = credit.TrainDayCount.ToString();
            tbHostUnit.Text = credit.HostUnit;
            trCurriculum.Visible = false;
            tblCurr.Visible = false;
            trPlace.Visible = false;
        }
        ExtraCredit extraCredit = new ExtraCredit(CreditID);
        if (extraCredit.Load())
        {
            tbBeginTime.Text = extraCredit.BeginTime.ToShortDateString();
            tbClassName.Text = extraCredit.TrainName;
            tbComment.Text = HttpUtility.HtmlDecode(extraCredit.Comment);
            tbEndTime.Text = extraCredit.EndTime.ToShortDateString();
            tbScore.Text = extraCredit.Score.ToString();
            tbTrainLevel.Text = extraCredit.TrainLevel;
            tbTrainDay.Text = extraCredit.TrainDayCount.ToString();
            tbHostUnit.Text = extraCredit.HostUnit;
            trCurriculum.Visible = false;
            tblCurr.Visible = false;
            trPlace.Visible = false;
        }


        //ClassMember member = new ClassMember(CurrentUser.ID, ClassID);
        //if (member.Load())
        //{
        //    if (member.Status == "终审驳回" || member.Status == "初审驳回")
        //    {
        //        ltTitle.Text = member.Status + "：" + member.AuditFailReason;
        //    }
        //}


    }

    protected void btnRefresh_Click(object sender, EventArgs e)
    {
        BindClass();
    }


}
